/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark-color);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

/* 主要内容 */
.main-content {
    padding: 30px;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--light-color);
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1em;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8f9fa;
}

.upload-area:hover {
    background: #e8f4f8;
    border-color: var(--secondary-color);
}

.upload-area.dragover {
    background: #e8f4f8;
    border-color: var(--secondary-color);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.upload-area p {
    margin: 5px 0;
    color: #666;
}

.upload-hint {
    font-size: 0.9em;
    color: #999;
}

/* 视频预览 */
.video-preview {
    margin-bottom: 20px;
}

.video-preview video {
    width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    background: #000;
    display: none;
}

.video-preview video.active {
    display: block;
}

/* 摄像头 */
.camera-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

#cameraVideo {
    width: 100%;
    border-radius: var(--border-radius);
    background: #000;
    display: none;
}

#cameraVideo.active {
    display: block;
}

.camera-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.camera-settings {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 15px;
    background: var(--light-color);
    border-radius: var(--border-radius);
}

.camera-settings label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.camera-settings input[type="checkbox"] {
    cursor: pointer;
}

.camera-settings input[type="number"] {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 设置区域 */
.settings-section {
    max-width: 500px;
}

.settings-section h3 {
    margin-top: 20px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.settings-section h3:first-child {
    margin-top: 0;
}

.setting-item {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 500;
}

.setting-item input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.setting-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.hint {
    font-size: 0.85em;
    color: #999;
}

/* 按钮 */
.control-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    font-size: 1.2em;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--light-color);
    color: var(--dark-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #d5dbdb;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #27ae60;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 结果区域 */
.results-section {
    padding: 30px;
    background: #f8f9fa;
    border-top: 1px solid var(--light-color);
}

.results-section h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

/* 进度条 */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 10px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* 状态消息 */
.status-message {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: none;
}

.status-message.show {
    display: block;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 结果列表 */
.results-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
}

.results-list {
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

.result-item {
    padding: 15px;
    border-bottom: 1px solid var(--light-color);
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.result-item:last-child {
    border-bottom: none;
}

.result-text {
    flex: 1;
    word-break: break-word;
}

.result-confidence {
    margin-left: 10px;
    padding: 4px 8px;
    background: var(--light-color);
    border-radius: 4px;
    font-size: 0.85em;
    white-space: nowrap;
}

.result-confidence.high {
    background: #d4edda;
    color: #155724;
}

.result-confidence.medium {
    background: #fff3cd;
    color: #856404;
}

.result-confidence.low {
    background: #f8d7da;
    color: #721c24;
}

/* 统计信息 */
.result-stats {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--light-color);
}

.result-stats h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    background: var(--light-color);
    border-radius: 4px;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

/* 导出按钮 */
.export-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* 信息框 */
.info-box {
    background: #e8f4f8;
    border-left: 4px solid #3498db;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.95em;
    line-height: 1.6;
}

.info-box p {
    margin: 8px 0;
    color: #2c3e50;
}

.info-box strong {
    color: #3498db;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .main-content {
        padding: 20px;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 100px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .camera-settings {
        flex-direction: column;
    }
}

